package com.lagou.blog.service.impl;


import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.lagou.blog.entity.Article;
import com.lagou.blog.mapper.ArticleMapper;
import com.lagou.blog.service.ArticleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ArticleServiceImpl implements ArticleService {
    @Autowired
    private ArticleMapper articleMapper;
    @Override
    public PageInfo<Article> findAll(Integer pageNum,Integer pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<Article> all = articleMapper.findAll();
        PageInfo<Article> pageinfo = new PageInfo<>(all);
        return pageinfo;
    }
}
